﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="J_TopMenu.ascx.cs" Inherits="Pub_Module_J_TopMenu" %>
<%@ Register Src="J_MyBasket.ascx" TagName="J_MyBasket" TagPrefix="uc2" %>
<%@ Register Src="J_Login.ascx" TagName="J_Login" TagPrefix="uc1" %>
<%@ Register Src="J_MyBasketFilm.ascx" TagName="J_MyBasketFilm" TagPrefix="uc3" %>
<script language="javascript" type="text/javascript" src="<%= ResolveClientUrl("~/")%>Pub/Js/JQ/jquery.corner.js"></script>

<script language="javascript" src="<%= ResolveClientUrl("~/")%>Pub/Js/JQ/jquery.blink.min.js"
    type="text/javascript"></script>

<script language="javascript" type="text/javascript">


    $(".TCorner").corner("bottom");
    $(".TopMenu").corner("bottom");
    var Url='<%= ResolveClientUrl("~/")%>';
 
    $(window).load(function() {   
    
                           fnLoadCountTopBasket(true,true); 
                           
                           $(".acloseIt").click(function () {    $(".T_SubLogin").hide(500); 
                           });                            
                            $(".aLogin").click(function () {$(".T_SubLogin").show(500);
                           }); 
                           
                            $(".acloseIt").click(function () {    $(".T_SubBasket").hide(500); 
                           }); 
                           $(".acloseItFilm").click(function () {    $(".T_SubBasketFilm").hide(500); 
                           });                         
                            $(".aBasket").click(function () {
                                $(".T_SubBasket").show(500);
                               fnMyBasket("P"); 
                           }); 
                          
                            $(".aBasketFilm").click(function () {
                                $(".T_SubBasketFilm").show(500);
                               fnMyBasketFilm("F"); 
                           });
                           LoadTop_Menu()
                    
                           
                           
    });         
    
   

    $(document).bind('click', function(e) {  
         var $clicked = $(e.target);
            if (! $clicked.parents().hasClass("T_SubLogin"))
                $(".T_SubLogin").hide();
            if (! $clicked.parents().hasClass("T_SubBasket"))
                $(".T_SubBasket").hide(); 
            if (! $clicked.parents().hasClass("T_SubBasketFilm"))
                $(".T_SubBasketFilm").hide(); 
        });

    
    function LoadTop_Menu()
    {
        
         
          $.ajax({ 
                                       type: "GET", 
                                       url: Url+"Pub/Ajax/AjaxQuery.aspx?type=GetTopMenu", 
                                       dataType: "json",
                                        contentType: "application/json; charset=utf-8",
                                       success: function(resp)
                                       {      
                                            $(".TCorner").removeClass('TCorner background');

                                              $("#<%= divProduct.ClientID%>").html(resp.Table[0].HTML1); 
                                              $("#<%= divHdFilm.ClientID%>").html(resp.Table[0].HTML2); 
                                              $("#<%= divSurport.ClientID%>").html(resp.Table[0].HTML3); 
                                       } 
                                });        
    }
    
    function   fnLoadCountTopBasket(IsPD,IsFilm)
    {
            
                    $.ajax({ 
                                       type: "GET", 
                                       url: Url+"Pub/Ajax/AjaxQuery.aspx?type=GetCountBasket",           
                                       dataType: "json",
                                       contentType: "application/json; charset=utf-8",
                                       success: function(resp)
                                       {     
                                               var count=resp.Table[0].HTML1;
                                                                                         
                                               if(count!="0")
                                               {    
                                                     $("#hrLinkMyBasket").show(); 
                                                    $(".cssCoutBasket").show();
                                                    $(".cssCoutBasket").html(count); 
                                                    if(IsPD==true)
                                                    {       
                                                        $(".cssCoutBasket").blink({
	                                                        speed: 300,
	                                                        blinks:5                                	           
                                                        });
                                                    }
                                                    //$(".cssCoutBasket").attr('title','Hiện có '+ res + ' sản phẩm trong giỏ hàng của bạn');
                                              } 
                                              else
                                              {
                                                     $(".cssCoutBasket").hide();
                                                     $("#hrLinkMyBasket").hide();
                                              }    
                                              var countHD=resp.Table[0].HTML2;  
                                              ProgressBarHD(countHD);
                                              
                                              //Film
                                              
                                              var countfilm=resp.Table[0].HTML3;
                                                                                         
                                               if(countfilm!="0")
                                               {    
                                                     $("#hrLinkMyBasketFilm").show(); 
                                                    $(".cssCoutBasketFilm").show();
                                                    $(".cssCoutBasketFilm").html(countfilm);        
                                                    if(IsFilm==true)
                                                    {
                                                        $(".cssCoutBasketFilm").blink({
	                                                        speed: 300,
	                                                        blinks:5                                	           
                                                        });                                                
                                                    }
                                              } 
                                              else
                                              {
                                                     $(".cssCoutBasketFilm").hide();
                                                     $("#hrLinkMyBasketFilm").hide();
                                              }    
                                            
                                       } 
                               });        
    }
    
   

   
    function LoadingAjax()         
    {
        $(document).ready(function() {
            $('<div class="div-loading"></div>')
               
            .ajaxStart(function() 
            {
                $(this).show();
            }).ajaxStop(function() 
            {
                $(this).hide();
            });
        });

    }     
    
    

</script>

<div class="TopMenu">
    <ul id="menu">
        <li style="margin-left: 20px"><a href="<%= ResolveUrl("~/")%>Home.aspx">Trang chủ
            <img align="bottom" src="<%= ResolveUrl("~/")%>Images/Icon/icon_home.gif" valign="right" /></a>
        </li>
        <li><a href="javascript:void(0)">Sản phẩm
            <img src="<%= ResolveUrl("~/")%>Images/Icon/arrow_expand.png" /></a>
            <ul id="T_Product" class="TCorner">
                <li>
                    <div id="divProduct" runat="server" style="padding: 10px 10px 10px 10px">
                    </div>
                    <br />
                </li>
            </ul>
        </li>
        <li><a href="javascript:void(0)">Phim HD
            <img src="<%= ResolveUrl("~/")%>Images/Icon/arrow_expand.png" /></a>
            <ul id="T_HdFilm" class="TCorner">
                <li>
                    <div id="divHdFilm" runat="server" style="padding: 10px 10px 10px 10px">
                    </div>
                    <br />
                </li>
            </ul>
        </li>
        <li><a href="javascript:void(0)">Hỗ trợ
            <img src="<%= ResolveUrl("~/")%>Images/Icon/arrow_expand.png" /></a>
            <ul id="Surport" class="TCorner">
                <li>
                    <div id="divSurport" runat="server">
                    </div>
                    <br />
                </li>
            </ul>
        </li>
    </ul>
    <ul id="T_Login">
        <li><a href="javascript:void(0)" class="aLogin">
            <asp:Label ID="lblLoginUser" runat="server" Text="Đăng nhập" CssClass="lblLogin" />
            <img src="<%= ResolveUrl("~/")%>Images/Icon/arrow_expand.png" />&nbsp;</a>
            <ul class="T_SubLogin">
                <li style="background-color: #ecf1ff; text-align: right; padding: 2px 10px 5px 2px;
                    vertical-align: middle" class='acloseIt'>
                    <asp:Label ID="lblcloseIt1" runat="server" Text="Label" CssClass="closeIt" Style="padding-right: 4px">Đóng lại</asp:Label>
                    <img src="<%= ResolveUrl("~/")%>Images/Icon/icon_up.gif" align="right" valign="middle" />
                </li>
                <li>
                    <div id="divLogin" runat="server" style="padding: 10px 10px 10px 10px">
                        <uc1:J_Login ID="J_Login1" runat="server"></uc1:J_Login>
                    </div>
                </li>
                <li style="background-color: #ecf1ff; text-align: right; padding: 2px 10px 5px 2px"
                    runat="server" id="liLogout">
                    <asp:LinkButton ID="btnLogout" runat="server" CssClass="LogoutButton" OnClick="btnLogout_Click"><img src="<%= ResolveUrl("~/")%>Images/Icon/icon-logout-small.png" align="right" style="padding-left:5px"/> Đăng xuất</asp:LinkButton>
                </li>
            </ul>
        </li>
        <li id="liReg" runat="server"><span class="line-v">&nbsp;</span>
            <asp:HyperLink ID="hplReg" runat="server" NavigateUrl='~/Register.aspx'>Đăng ký</asp:HyperLink>
        </li>
        <li style="padding-left: 5px; padding-top: 5px; padding-right: 5px"><span class="aBasket">
            <fieldset class="cssFieldsetBasket">
                <legend class="cssLegendBasket"><span class="cssCoutBasket" style="display: none"></span>
                </legend>
                <img src="<%= ResolveUrl("~/")%>Images/Icon/icon_basket.png" />
            </fieldset>
        </span>
            <ul class="T_SubBasket">
                <li class='acloseIt' style="background-color: #ecf1ff; text-align: right; padding: 2px 10px 5px 2px">
                    <asp:Label ID="Label2" runat="server" CssClass="closeIt" Text="Label" Style="padding-right: 4px">Đóng lại</asp:Label>
                    <img src="<%= ResolveUrl("~/")%>Images/Icon/icon_up.gif" align="right" valign="middle" />
                </li>
                <li>
                    <div id="div1" runat="server" style="padding: 10px 10px 10px 10px; text-align: right">
                        <a href="<%= ResolveUrl("~/")%>Cart/P.aspx" class="cssPathLink" id="hrLinkMyBasket"
                            style="display: none; font-size:12px; font-weight:bold">Giỏ hàng của bạn 
                             &nbsp;<img align="right" src="<%= ResolveUrl("~/")%>Images/Icon/icon-basket.gif" valign="top"
                                align="right" /></a>
                        <uc2:J_MyBasket ID="J_MyBasket1" runat="server" KindNo="P" />
                    </div>
                </li>
            </ul>
        </li>
        <li style="padding-left: 5px; padding-top: 5px; padding-right: 5px"><span class="aBasketFilm">
            <fieldset class="cssFieldsetBasket">
                <legend class="cssLegendBasket"><span class="cssCoutBasketFilm" style="display: none">
                </span></legend>
                <img src="<%= ResolveUrl("~/")%>Images/Icon/film.png" width="20px" />
            </fieldset>
        </span>
            <ul class="T_SubBasketFilm">
                <li class='acloseItFilm' style="background-color: #ecf1ff; text-align: right; padding: 2px 10px 5px 2px">
                    <asp:Label ID="Label1" runat="server" CssClass="closeIt" Text="Label" Style="padding-right: 4px">Đóng lại</asp:Label>
                    <img src="<%= ResolveUrl("~/")%>Images/Icon/icon_up.gif" align="right" valign="middle" />
                </li>
                <li>
                    <div id="div2" runat="server" style="padding: 10px 10px 10px 10px; text-align: right">
                        <a href="<%= ResolveUrl("~/")%>CartFilm/F.aspx" class="cssPathLink" id="hrLinkMyBasketFilm"
                            style="display: none; font-size:12px; font-weight:bold">List phim của bạn&nbsp; 
                            <img align="right" src="<%= ResolveUrl("~/")%>Images/Icon/icon-basket.gif" valign="top"
                                align="right" /></a>
                        <uc3:J_MyBasketFilm ID="J_MyBasket2" runat="server" KindNo="F" />
                    </div>
                </li>
            </ul>
        </li>
    </ul>
</div>
